package com.cskaoyan.service;

import com.cskaoyan.bean.bo.WxFeedbackSubmitBO;
import com.cskaoyan.bean.po.MarketFeedback;
import com.cskaoyan.bean.po.MarketUser;
import com.cskaoyan.mapper.MarketFeedbackMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhuqiushi
 * @since 2022/09/09 16:12
 */
@Service
public class WxFeedbackServiceImpl implements WxFeedbackService{
    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;
    @Override
    public int submit(WxFeedbackSubmitBO wxFeedbackSubmitBO, MarketUser user) {
        MarketFeedback marketFeedback = new MarketFeedback();
        BeanUtils.copyProperties(wxFeedbackSubmitBO,marketFeedback);
        marketFeedback.setUserId(user.getId());
        marketFeedback.setUsername(user.getUsername());
        Date date = new Date(System.currentTimeMillis());
        marketFeedback.setAddTime(date);
        marketFeedback.setUpdateTime(date);
        marketFeedback.setDeleted(false);
        //插入
        marketFeedbackMapper.insertSelective(marketFeedback);
        return 0;
    }
}
